package homework.ch11_13.p3;

import java.util.Objects;

public class Student extends Person implements Cloneable{
    private String classNo;
    private String department;
    private int studentId;

    public Student(){

    }

    public Student(String name,int age,int studentId,String department,String classNo){
        this.department=department;
        this.classNo=classNo;
        this.studentId=studentId;
        super.setAge(age);
        super.setName(name);
    }

    public Object clone()throws CloneNotSupportedException{
        Student t=(Student)super.clone();
        t.classNo=this.classNo;
        t.studentId=this.studentId;
        t.department=this.department;
        return t;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        Student student = (Student) o;
        return studentId == student.studentId && classNo.equals(student.classNo) && department.equals(student.department);
    }

    @Override
    public int hashCode() {
        return Objects.hash(classNo, department, studentId);
    }

    public String toString(){
        return "    "+super.toString()+" studentId:"+this.studentId+','+" department:"+this.department+','+" class:"+this.classNo+"\n";
    }
    public String getClassNo() {
        return classNo;
    }

    public void setClassNo(String classNo) {
        this.classNo = classNo;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public int getStudentId() {
        return studentId;
    }

    public void setStudentId(int studentId) {
        this.studentId = studentId;
    }


}
